package cn.edu.swu.homework2

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.EditText
import android.widget.Toast

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val edt1: EditText = findViewById(R.id.editText)
        val edt2: EditText = findViewById(R.id.editText2)
        val bt: Button = findViewById(R.id.button2)
        bt.setOnClickListener {
            val inputText1 = edt1.text.toString()
            val inputText2 = edt2.text.toString()
            println(inputText1)
            Log.d("debugLog", inputText1)
            println(inputText2)
            Log.d("debugLog", inputText2)
            if (inputText1 == "lxy" && inputText2 == "123456")
            {
                print("login success")
                val intent = Intent(this, SecondActivity::class.java)
                startActivity(intent)
            }
            else
            {
                Toast.makeText(this, "Login Failed！", Toast.LENGTH_LONG).show()
            }
        }


    }

}